const Router = require('@koa/router');
// Koa 的路由在被 use 时是无法指定前缀的, 需要在定义时就指定前缀
const router = Router({
    prefix: '/api/Account'
});

const accountController = require('../controllers/accountController');
const mgRecordController = require("../controllers/mgRecordController");

// 组装路由
router.get('/', accountController.listAll);
router.get('/:id', accountController.getOneById);
router.post('/', accountController.add);
router.put('/', accountController.updateOneById);
router.delete('/:id', accountController.deleteById);
router.get('/getUserPrice/:info_id', accountController.getUserPrice);
router.get('/getGroupTypeIncomePrice/:info_id', accountController.getGroupTypeIncomePrice);
router.get('/getGroupTypeExpenditurePrice/:info_id', accountController.getGroupTypeExpenditurePrice);
router.get('/getGroupPaymentExpenditurePrice/:info_id', accountController.getGroupPaymentExpenditurePrice);
router.get('/getGroupPaymentIncomePrice/:info_id', accountController.getGroupPaymentIncomePrice);
router.post('/queryById', accountController.queryById);

// Koa 的路由需要调用 routes 函数获取实际用于 use 的函数
module.exports = router.routes();